x86/time: Remove redundant RTC REG_B read
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Feb 2014 16:21:22 +0000 (17:21 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2014 16:21:22 +0000 (17:21 +0100)
RTC_ALWAYS_BCD is always defined by default, meaning that we will
unconditionally enter the if statement.  Reordering the condition allows
short-circult evaluation to remove a redundant CMOS read.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/time.c

index 6e31e1faeda9f3f13454eae1852c73760914e4f0..82492c17840fe484a1a4dc1d0af9329defb34906 100644 (file)
@@ -661,7 +661,7 @@ static unsigned long __get_cmos_time(void)
     mon  = CMOS_READ(RTC_MONTH);
     year = CMOS_READ(RTC_YEAR);
     
-    if ( !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD )
+    if ( RTC_ALWAYS_BCD || !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) )
     {
         BCD_TO_BIN(sec);
         BCD_TO_BIN(min);